/**
 * Copyright (c) OpenLens Authors. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */

import { Renderer } from "@k8slens/extensions";
import React from "react";
//pod文件管理器菜单
import { PodFileManagerMenu, dialogState } from "./src/pod-file-manager-menu";
import { PodFileManagerDialog,viewFileDialogState} from "./src/pod-file-manager-dialog";
import { PodFileViewDialog} from "./src/pod-file-view-dialog";
import { computed, observable, runInAction } from "mobx";
import { observer } from "mobx-react";





export function PodFileManagerIcon(props: Renderer.Component.IconProps) {
  return <Renderer.Component.Icon {...props} material="folder" tooltip="PodFileManager" />
}
export default class PodFileManagerExtension extends Renderer.LensExtension {
  kubeObjectMenuItems = [
    {
      kind: "Pod",
      apiVersions: ["v1"],
      components: {
        MenuItem: (props: Renderer.Component.KubeObjectMenuProps<Renderer.K8sApi.Pod>) => <PodFileManagerMenu {...props} />,
      },
    },
  ]

  //添加文件管理弹框页面
  clusterFrameComponents = [{
    id: "PodFileManagerDialog",
    Component: () => <PodFileManagerDialog isDialogOpen={computed(() => dialogState.isOpen.get())}></PodFileManagerDialog>,
    shouldRender: computed(() => true),

  },{
    id: "PodFileViewDialog",
    Component: () => <PodFileViewDialog isDialogOpen={computed(() => viewFileDialogState.isOpen.get())}></PodFileViewDialog>,
    shouldRender: computed(() => true),

  }]
}